import { request } from "ice";
import type { LoginParams, LoginResult } from "@/interfaces/user";
export interface UserInfo {
  id: string;
  username: string;
  avatar?: string;
  email?: string;
  roles?: string[];
}

// 登录接口
export const loginApi = {
  login: async (data, params) => {
    return request({
      method: "POST",
      data,
      url: "/auth/login",
    });
  },

  getUserInfo: () => {
    return request.get<UserInfo>("/user/info");
  },

  logout: (data,params) => {
    return request({
      method: "POST",
      data,
      url: "/auth/logout",
    });
  },
};
